package com.hujh.android.ui.tabhost;

import android.app.TabActivity;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.widget.TabHost;
import android.widget.TabHost.TabSpec;

import com.hujh.android.R;

//不继承TabActivity
public class TabHost2Activity extends TabActivity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		TabHost tabHost = this.getTabHost();
		
		//把我们的布局文件添加到tabHost的frameLayout下面
		LayoutInflater.from(this).inflate(R.layout.activity_host2, tabHost.getTabContentView(),true);
		
		//创建选项卡
		TabSpec tabSpec1 = tabHost.newTabSpec("tab1");
		tabSpec1.setIndicator("文件1", this.getResources().getDrawable(R.drawable.folder));
		tabSpec1.setContent(R.id.V1);
		
		TabSpec tabSpec2 = tabHost.newTabSpec("tab2");
		tabSpec2.setIndicator("文件2", this.getResources().getDrawable(R.drawable.download));
		tabSpec2.setContent(R.id.V2);
		
		tabHost.addTab(tabSpec1);
		tabHost.addTab(tabSpec2);
		
		
		
		
	}

}
